<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ page import="com.dog.lucene.first.IndexSearch" %>
<%@ page import="com.dog.lucene.first.IndexManager" %>
<%@ page import="com.dog.domain.Crawl" %>
<%@ page import="java.util.List" %>
<%@ page import="org.wltea.analyzer.lucene.IKAnalyzer" %>
<%@ page import="org.apache.lucene.analysis.standard.StandardAnalyzer" %>
<%@ page import="org.apache.lucene.index.IndexReader" %>
<%@ page import="org.apache.lucene.queryparser.classic.QueryParser" %>
<%@ page import="org.apache.lucene.search.IndexSearcher" %>
<%@ page import="org.apache.lucene.search.Query" %>
<%@ page import="java.util.ArrayList" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>
	<style type="text/css">
 	 	.table{border:solid #FFAEB9; border-width:1px 0px 0px 1px;width: 100%;font-size: 12px;line-height: 21px;text-align:center;}
	 	.table thead td{border:solid #FFAEB9; border-width:0px 1px 1px 0px;}
    	.table tbody td{border:solid #FFAEB9; border-width:0px 1px 1px 0px;padding-right: 5px;padding-left: 5px;}
	</style>
</head>
<body>


	
<form action="query1.jsp" method="GET">
站点名: <input type="text" name="name">
<br />
<input type="submit" value="提交" />

</form>
<%

List <Crawl> lis=new ArrayList();


//IndexManager b=new IndexManager();
//b.createIndex();
//out.print("索引成功");


//mmp俩个分开，免得又注释了
//解决中文乱码


String test = null; 
 
try {
	String str = new String(request.getParameter("name").getBytes("ISO-8859-1"),"utf-8");
	//就是不知道为什么str不赋值给test的话会一直报错？？？这个好好的去研究一下
	//out.print(str);
	test=str;
	IndexSearch a=new IndexSearch();
	QueryParser parser = new QueryParser("description",
			new IKAnalyzer());
	Query query = parser.parse(str);
	lis=a.doSearch(query);
	

		out.print(123);
		for(Crawl crawl: lis){
			out.print(crawl.getDescription()+"<br>");
		}
		

} catch (Exception e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}




%>











</body>
</html>
